<?php Schema::init(); ?>
<div class="schema_wrapper">
	<?php if ($error > -1) { ?>
		<div class="schema_message">
		<?php if (!$error) {
			Backend::infoMessage('User inserted sucsesfuly');
		} else {
			Backend::errorMessage('Error inserting user');
		} ?>
		</div>
	<?php } ?>

	<div class="schema_header">
		Inserting new user
	</div>
	<form action="<?php echo CURRENT_URL; ?>" method="post">
		<div class="schema_tabs">
			<a href="#0" id="schema_tab_0" class="tab_on" onclick="Core.Schema.openTab(0)">General</a>
		</div>
		<div class="schema_blocks">
			<div class="schema_block" id="schema_block_0">
				<table border="0" width="100%" cellspacing="10" cellpadding="0">
					<colgroup>
						<col class="schema_column_headers" />
						<col class="schema_column_fields" />
					</colgroup>
					<tr>
						<td class="schema_cell_header">User name</td>
						<td class="schema_cell_field"><input type="text" name="user_name" class="schema_textfield" /></td>
					</tr>
					<tr>
						<td class="schema_cell_header">Login</td>
						<td class="schema_cell_field"><input type="text" name="user_login" class="schema_textfield" /></td>
					</tr>
					<tr>
						<td class="schema_cell_header">Password</td>
						<td class="schema_cell_field"><input type="password" name="user_password" class="schema_textfield" /></td>
					</tr>
					<tr>
						<td class="schema_cell_header">UTC offset</td>
						<td class="schema_cell_field">
							<select id="user_utc_offset" name="user_utc_offset" class="schema_select">
							<?php for ($i = -86400; $i <= 86400; $i += (60 * 30)) {
								$selected = '';
								if (!$i) {
									$selected = ' selected';
								} ?>
								<option value="<?php echo $i; ?>"<?php echo $selected; ?>><?php echo Tools::secondsToTimeString($i); ?></option>
							<?php } ?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="schema_cell_header">Daylight saving time</td>
						<td class="schema_cell_field"><input type="checkbox" id="user_dst_offset" name="user_dst_offset" class="schema_checkbox" /></td>
					</tr>
					<tr>
						<td class="schema_cell_header">Status</td>
						<td class="schema_cell_field">
							<select name="user_status_id" class="schema_select">
								<option value="1" selected="selected">Opened</option>
								<option value="2">Closed</option>
							</select>
						</td>
					</tr>
					<tr>
						<td class="schema_cell_header">Group</td>
						<td class="schema_cell_field">
							<select id="user_group_id" name="user_group_id" class="schema_select">
								<option value="0">-- Select group --</option>
							<?php
							foreach ($group_list as $group) {
								$selected = '';
								if ($group_id == intval($group['id'])) {
									$selected = ' selected';
								} ?>
								<option value="<?php echo $group['id']; ?>"<?php echo $selected; ?>><?php echo $group['name']; ?></option>
							<?php } ?>
							</select>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<div class="schema_buttons"><input type="submit" value="Insert" class="schema_submit" /></div>
	</form>
</div>